package main

import (
	"fmt"
	_interface "gitee.com/garychou/diploma-project/cmd/interface"
	"gitee.com/garychou/diploma-project/configs"
	"github.com/urfave/cli"
	"os"
)

func main() {
	app := cli.NewApp()
	app = &cli.App{
		Name:    "极客时间Go进阶训练营第3期毕业项目V1",
		Usage:   "GaryChou",
		Version: "0.0.1",
		Action:  env,
		Flags: []cli.Flag{
			cli.StringFlag{Name: "env, ENV", Usage: "设置运行环境env"},
		}}
	if err := app.Run(os.Args); err != nil {
		panic(fmt.Sprintf("加载环境变量失败, Err: %v, Args: %v", err, os.Args))
	}

	_interface.Run() // 启动BFF
}

func env(c *cli.Context) {
	//init配置
	config := configs.GetConfig()
	config.SetEnv(c.String("env"))
	config.SetBasePath()
}
